from tabulate import tabulate
 
data = [
    ["苹果", 696000, 1.9891e+09],
    ["香蕉", 6371, 5.9736e+03],
    ["橘子", 1737, 7.35],
    ["桃子", 3390, 6.4185e+02]
]

print(tabulate(data))


from tabulate import tabulate
 
data = [
    ["苹果", 696000, 1.9891e+09],
    ["香蕉", 6371, 5.9736e+03],
    ["橘子", 1737, 7.35],
    ["桃子", 3390, 6.4185e+02]
]
 
 
headers = ["名称", "重量 (km)", "数量 (10^24 kg)"]
print(tabulate(data, headers=headers, tablefmt="github", floatfmt=".2f"))


from tabulate import tabulate

data = {
    "Alice": {"Age": 24, "Score": 89.5},
    "Bob": {"Age": 19, "Score": 92.3},
    "Charlie": {"Age": 22, "Score": 85.7},
    "David": {"Age": 21, "Score": 90.1}
}

headers = ["Name", "Age", "Score"]
table = tabulate(data, headers, tablefmt="grid")

print(table) 